import { request } from "./request";

export function submitEditContent(formData) {
    return request({
        url: '/edits/submit-for-all',
        method: 'post',
        data: formData
    })
}

export function saveCode(content, lang) {
    return request({
        url: 'edits/save',
        method: 'post',
        params: {
            content: content,
            lang: lang,
            key: 'edit'
        }
    })
}

export function recoverCode() {
    return request({
        url: 'edits/recover',
        method: 'get',
        params: {
            key: 'edit'
        }
    })
}

export function submitFileForm(data) {
    return request({
        url: '/files/upload',
        method: 'post',
        data: data
    })
}

export function getResult(fileId) {
    return request({
        url: '/files/get-result',
        method: 'get',
        params: {
            fileId: fileId
        }
    })
}

export function exportResult(fileId, exportType, format) {
    return request({
        url: 'files/export',
        method: 'get',
        params: {
            fileId: fileId,
            exportType: exportType,
            exportFormat: format // 这里设置 exportFormat 参数
        },
        responseType: 'blob'
    })
}